<template>
	<div>
		<el-select style="width:650px;" show-word-limit clearable v-model="props.paramter" filterable 
			reserve-keyword placeholder="可输入订单号/物料名称/派工单号"  :loading="loading"
			@change="selectChange">
			<el-option v-for="item in options" :key="item.id" :label="item.label" :value="item.value" />
		</el-select>
	</div>
</template>

<script lang="ts" setup>
	import { onMounted, ref } from 'vue';
	import _ from 'lodash';
	import request from '/@/utils/request';
	interface ListItem {
		id : number,
		key : string,
		label : string,
		value : any
	}
	var props = defineProps({
		paramter: {
			type: String,
			default: "",
		},
		info: {
			default: {}
		}
	});
	const options = ref<ListItem[]>([])
	const loading = ref(false)
	let value = ref<any>()
	//定义一个回调方法
	const emit = defineEmits(["callBack"]);

	onMounted(async () => {
		await getInfos();
	})
	

	const getInfos = async () => {
		var url = `api/Common/PoWorkOrderListItems/${props.info.stationcode}`
		var res = await request({ url: url, method: 'get' });
		options.value= res.data.result;
	};
	//调用父组件的一个方法将子组件值传过去
	const selectChange = (item) => {
		emit("callBack", item);
	}
</script>